<template>
  <div>
    <el-cascader
      v-model="value"
      :options="optionsUser"
      placeholder="请选择用户地址"
      style="width: 18%"
    />

    <el-button type="primary" :disabled="select" @click="changeSelect">开始查询</el-button>
  </div>
</template>
<script>
import houseApi from '../../../api/house'
export default {
  data() {
    return {
      optionsUser: [],
      value: []

    }
  },

  computed: {
    select() {
      return !this.value[1]
    }

  },
  async mounted() {
    const house = await houseApi.getBuilding()
    this.optionsUser = house.map((item) => {
      item.children = item.children.map((item1) => {
        item1.value = item1._id
        return item1
      })
      return item
    })
  },

  methods: {

    changeSelect() {
      this.$emit('gethouse', this.value[1])
    }

  }

}
</script>

<style  scoped>

div{

  margin-bottom: 10px;
}

</style>>

